<?php


namespace App\Request\client;


use App\Request\CommonRequest;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class TalkRequest extends CommonRequest
{
    protected $name = '用户聊天信息验证';

    protected $rule = [
        'appUploadTalkInfo' => [
            'content' => 'required|max:255',
            'type' => 'required',
//            'nickname' => 'required_without:mobile',
//            'mobile' => 'required_without:nickname',
            'timestamp' => 'required',
        ],
        'appMessageTalk' => [
            'content' => 'required|max:255',
            'type' => 'required',
        ],
        'appGetFriendLastMessage' => [
            'mobile' => 'required',
        ]
    ];

    protected $message = [
        'content.required' => '聊天内容不能为空',
        'type.required' => '聊天类型不能为空',
        'mobile.required' => '好友手机号码不能为空',
        'bookname.required_without' => '备注名称和手机号码不能同时为空',
        'nickname.required_without' => '好友昵称和手机号码不能同时为空',
        'mobile.required_without' => '手机号码和好友昵称不能同时为空',
        'timestamp.required' => '时间值不能为空'
    ];


    /**
     * 验证
     * @param array $params
     * @param string $scenes
     * @return bool
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function validated(array $params, string $scenes): bool
    {
        return $this->__validated($params, $scenes);
    }
}